﻿using System.Collections;
using UnityEngine;

namespace Assets.Scripts.Data.Protobuf
{
    public abstract class ProtoReaderBase:MonoBehaviour
    {

        protected string Path = "ClientProto/";
        protected abstract string FileName { get; }
        protected virtual byte[] GetProtoBytes()
        {
            TextAsset textAsset = Resources.Load<TextAsset>(Path + FileName+".protodata");
            if (textAsset != null)
            {
                return textAsset.bytes;
            }
            else
            {
                Debug.Log("不存在文件：" + Path + FileName);
                return null;
            }
        }
        protected abstract IEnumerator ReaderProtoBuf();
        protected void Start()
        {
            StartCoroutine(ReaderProtoBuf());
        }
    }
}